// Copyright 2008 Google Inc.
// All Rights Reserved.

//This file lists all the requests

FS.req = {};
//all Request will add this default value
osapps.req.Request_DefaultHttpParameters["ctn"] = FS.deployInfo.container_id;

//?cmd=get_player&ctn=${ctn}&uid=${uid}
FS.req.GetPlayer = function (uid) {
  osapps.req.extendsPostRequest(this);
  
  this.put("cmd", "getperson");
  if (uid) {
    this.put("id", uid);
  }
};

//?cmd=create_player&ctn=${ctn}&uid=${uid}&name=${name}&photoUrl=${photoUrl}
FS.req.CreatePlayer = function (name, photoUrl) {
  osapps.req.extendsPostRequest(this);
  
  this.put("cmd", "init");
  this.put("name", name);
  this.put("photoUrl", photoUrl);
};

FS.req.CreatePlayer.prototype.isValid = function() {
  return this.checkValue("cmd","init")
         && this.checkExist("ctn")
         && this.checkExist("vid")
         && this.checkExist("name");
};

FS.req.FriendList = function() {
	osapps.req.extendsPostRequest(this);
	
	this.put("cmd","friendlist");
	this.put("friends",FS.friendids);
	
};

FS.req.Buy = function(targetid,nickname){
	osapps.req.extendsPostRequest(this);
	this.put("cmd","buy");
	this.put("slaveid",targetid);
	this.put("nickname",nickname);
};

FS.req.FreeSlave = function(targetid){
	osapps.req.extendsPostRequest(this);
	this.put("cmd","release");
	this.put("targetid",targetid);
};

FS.req.CmdList = function(type){
	osapps.req.extendsPostRequest(this);
	this.put("cmd","cmdlist");
	this.put("type",type);
};

FS.req.Dostuff = function(cmd,targetid){
	osapps.req.extendsPostRequest(this);
	this.put("cmd",cmd);
	this.put("targetid",targetid);
};

FS.req.Ransom = function(){
	osapps.req.extendsPostRequest(this);
	this.put("cmd","ransom");
}
